<template>
    <div class="swiper-container" ref="slider">
        <div class="swiper-wrapper"  align="center">
            <div v-for="s in slides" class="swiper-slide">
                <img :src="s.img_url" />
            </div>
        </div>
        <div class="swiper-pagination" ref="pagination"></div>
        <div class="announcement">
            <label>快讯</label>
            <span>{{ announcement }}</span>
        </div>
    </div>
</template>

<script type="text/ecmascript-6">
    import Swiper from "swiper"
    import 'swiper/dist/css/swiper.css'

    export default{
        data(){
            return {
                announcement:'今日上架的图书全部8折',
                slides:[{img_url: require('./fixtures/sliders/t1.svg')},
                    {img_url:require('./fixtures/sliders/t2.svg')}],
            }
        },

        mounted() {
            new Swiper(this.$refs.slider, {
                pagination: this.$refs.pagination,
                paginationClickable: true,
                spaceBetween: 30,
                centeredSlides: true,
                autoplay: 2500,
                autoplayDisableOnInteraction: false
            })
        }
    }
</script>